package com.huangjian.controller;


import com.huangjian.pojo.Order;
import com.huangjian.service.OrderClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class OrderConsumerController {
    //消费者 : 不应该有service层

    @Autowired
    private OrderClientService orderClientService=null;

    @RequestMapping("/consumer/order/get/{id}")
    @ResponseBody
    public Order getOrder(@PathVariable("id")Integer id) {
        //service不在本项目中，所以要去远程项目获取
        return orderClientService.queryById(id);
    }

    @RequestMapping("/consumer/order/list")
    @ResponseBody
    public List<Order> queryAll() {
        return orderClientService.queryAll();
    }
}
